package com.tzu.utils;

/**
 * @author wangzhao
 * @date 2021/7/5 15:07
 */
public class DBTools {
    public static final String DRIVER_ORACLE = "oracle.jdbc.OracleDriver";
    public static final String DRIVER_ORALCE_OLD = "oracle.jdbc.driver.OracleDriver";
    public static final String DRIVER_MYSQL_5X = "com.mysql.jdbc.Driver";
    public static final String DRIVER_MYSQL_6X = "com.mysql.cj.jdbc.Driver";
    public static final String DRIVER_POSTGRESQL = "org.postgresql.Driver";
    public static final String DRIVER_SQLSERVER_2005 = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    public static final String DRIVER_SQLSERVER_2000 = "com.microsoft.jdbc.sqlserver.SQLServerDriver";


    public static String getOracleUrl(String host, String port, String orcl) {
        StringBuilder url = new StringBuilder("jdbc:oracle:thin:@");
        url.append(host).append(":").append(port).append("/").append(orcl);
        return url.toString();
    }

    public static String getMySQLUrl(String host, String port, String user) {
        StringBuilder url = new StringBuilder("jdbc:mysql://");
        url.append(host).append(":").append(port).append("/").append(user);
        url.append("?useUnicode=true&characterEncoding=utf-8");
        return url.toString();
    }

}
